﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;

namespace TouchPoint.Engine.Utils
{
    public class QuadTree
    {
        #region Node Impelement
        public class QuadTreeNode<W>
        {
            public QuadTreeNode(Rect rect)
            {
                Bounds = rect;
            }

            public Rect Bounds { get; set; }
            public List<W> Datum { get; set; }
            public QuadTreeNode<W> NorthWest { get; set; }
            public QuadTreeNode<W> NorthEast { get; set; }
            public QuadTreeNode<W> SouthWest { get; set; }
            public QuadTreeNode<W> SouthEast { get; set; }
            public static QuadTreeNode<W> Empty = new QuadTreeNode<W>(default(Rect));
        }
        #endregion

        private int                     _depth; //四叉树的深度
        private int                     _count; //四叉树的节点数
        private QuadTreeNode<long>      _Root;  //四叉树的根节点

        #region Constructor
        /// <summary>
        /// 初始化四叉树
        /// </summary>
        public QuadTree()
        {
            _count = 0;
        }
        #endregion

        #region Public Method
        /// <summary>
        /// 使用指定的区域范围初始化四叉树
        /// </summary>
        /// <param name="windowSize">初始化渲染区域大小</param>
        public void Init(Rect windowSize)
        {
            _Root = new QuadTreeNode<long>(windowSize);
        }

        public void Split()
        {

        }

        public void Move()
        {

        }
        #endregion  
    }
}
